package javabase.collection.list.search;

/**
 * <pre>
 *   Title: ListSearch.java
 *   Description: 
 *   Copyright: yundaex.com Copyright (c) 2013
 *   Company: 上海韵达货运有限公司
 * </pre>
 * 
 * @author liuzhaoqing
 * @version 1.0
 * @date 2014年11月6日
 */
public class ListSearch {

//	List<Person> personList = new ArrayList<Person>();
//
//	  /**
//	   * Basic method which creates the list of person object's
//	   *
//	   */
//	  void setUpData() {
//	    personList.add(new Person("ganesh", "gowtham", 35000));
//	    personList.add(new Person("britney", "spears", 45000));
//	    personList.add(new Person("ganesh", "gowtham", 36000));
//	    personList.add(new Person("ganesh", "dummy", 45000));
//	  }
//
//	  /**
//	   *
//	   * Here we are adding multiple predicate
//	   * filters the collection so that final person object will contain
//	   * firstName as "ganesh" & lastName as "gowtham"
//	   */
//	  void filterDataUsingMultipleCriteria() {
//	    org.apache.commons.collections.Predicate firstNameEqlPredicate = new EqualPredicate("ganesh");
//	    BeanPredicate firtsNameBeanPredicate = new BeanPredicate("firstName", firstNameEqlPredicate);
//	    org.apache.commons.collections.Predicate lastNameEqlPredicate2 = new EqualPredicate("gowtham");
//	    BeanPredicate lastNameBeanPredicate2 = new BeanPredicate("lastName", lastNameEqlPredicate2);
//	    Predicate[] allPredicateArray = { firtsNameBeanPredicate, lastNameBeanPredicate2 };
//	    Predicate allPredicate = org.apache.commons.collections4.PredicateUtils.allPredicate(allPredicateArray);
//	    Collection<Person> filteredCollection = CollectionUtils.select(personList, allPredicate);
//
//	    for (Person person : filteredCollection) {
//	      System.out.println(person);
//	    }
//	  }
//
//	  public static void main(String[] args) {
//		  ListSearch chainExample = new ListSearch();
//	    chainExample.setUpData();
//	    chainExample.filterDataUsingMultipleCriteria();
//	  }
}
